<template>
  <div>
    加载页面,接下来会跳转
  </div>
</template>

<script>
export default {
  name: "CheckIdentity",
  created() {
    this.getIdentity()
  },
  methods: {
    getIdentity() {
      this.$axios.get("/sys/userInfo").then(res => {
        this.userRole = res.data.data.userRole;
        this.password = res.data.data.password;
        console.log(res.data.data);
        if(this.userRole === "学生"){
          if(this.password === "123456"){
            this.$router.push("/student/editUserInfo");
            this.$message({
              showClose: true,
              message: '请修改初始密码',
              type: 'warning',
            })
          }else{
            this.$router.push("/student")
          }
        }else if(this.userRole === "教师"){
          if(this.password === "123456"){
            this.$router.push("/teacher/editUserInfo")
            this.$message({
              showClose: true,
              message: '请修改初始密码',
              type: 'warning',
            })
          }else{
            this.$router.push("/teacher")
          }
        }else{
          this.$router.push("/admin")
        }
      })
    },
  }
}
</script>

<style scoped>
  div{
    margin: auto;
    width: 100%;
    height: 100%;
    background-color: #D3DCE6;
  }
</style>